import cv2

if __name__ == '__main__':
    img1 = cv2.imread('kongfu_panda.jpg')
    img2 = cv2.imread('kongfu_panda.jpg')
    img3 = cv2.imread('kongfu_panda.jpg')
    cv2.imshow('111', img1)
    while True:
        key = cv2.waitKey(0)
        if key == ord('a'):
            cv2.destroyWindow('111')
            cv2.imshow('a', img1)
            cv2.waitKey(0)
        elif key == ord('b'):
            cv2.destroyWindow('a')
            cv2.imshow('b', img2)
            cv2.waitKey(0)
        elif key == 27:
            break
        elif key != -1:
            cv2.destroyWindow('b')
            cv2.imshow('c', img3)
            cv2.waitKey(0)

    cv2.destroyAllWindows()